Skip to content

DOC: add print statement in to_latex example #27798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 8, 2019
Merged

DOC: add print statement in to_latex example #27798

merged 4 commits into from
Aug 8, 2019

Conversation

sameshl
Copy link
Contributor

@sameshl sameshl commented Aug 7, 2019

changed df.to_latex to print(df.to_latex)

closes #27789

sameshl added 2 commits August 7, 2019 15:33
changed `df.to_latex` to `print(df.to_latex)`

closes #27789
replaced old example with new updated example
@jorisvandenbossche jorisvandenbossche added this to the 1.0 milestone Aug 7, 2019
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Added a small comment

\\\\\n\\midrule\n Raphael & red & sai \\\\\n Donatello &
purple & bo staff \\\\\n\\bottomrule\n\\end{tabular}\n'
>>> print(df.to_latex(index=False)) # doctest: +NORMALIZE_WHITESPACE
'\begin{tabular}{lll}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the single quote (the first character) should also be removed (isn't showed by python when printing)

\bottomrule
\end{tabular}

'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the same here

@sameshl
Copy link
Contributor Author

sameshl commented Aug 7, 2019

@jorisvandenbossche Done!

@jorisvandenbossche jorisvandenbossche changed the title DOC:add print statement in to_latex example DOC: add print statement in to_latex example Aug 7, 2019
name & mask & weapon \\
\midrule
Raphael & red & sai \\
Donatello & purple & bo staff \\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me the & are aligned in the output, like

In [14]: print(df.to_latex(index=False))                                                                                                                      
\begin{tabular}{lll}
\toprule
      name &    mask &    weapon \\
\midrule
   Raphael &     red &       sai \\
 Donatello &  purple &  bo staff \\
\bottomrule
\end{tabular}

Donatello & purple & bo staff \\
\bottomrule
\end{tabular}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and a very small detail: can you remove this trailing white line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it because it looked like it was there in the output when I tried it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But removed now

@sameshl
Copy link
Contributor Author

sameshl commented Aug 7, 2019

@jorisvandenbossche I am not able to understand what is causing the test failure. Can you help me out

@jorisvandenbossche
Copy link
Member

@sameshl that seems as an unrelated failure that you can ignore (I need to check if there is already an issue about this failure, it might be a flaky test)

@jorisvandenbossche jorisvandenbossche merged commit fae84ec into pandas-dev:master Aug 8, 2019
@jorisvandenbossche
Copy link
Member

@sameshl Thanks a lot!

quintusdias pushed a commit to quintusdias/pandas_dev that referenced this pull request Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: add print statement in to_latex example
2 participants